/*
 * @author tanyuze
 */
'use strict'
import request from '@/utils/request'
/**
 * 字典
 */
export function getDictByCode(dictCode) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/sysDictionary/getDictByCode',
    method: 'POST',
    data: { dictCode }
  })
}

// 活动列表
export function queryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/queryPage',
    method: 'post',
    data
  })
}

// 排行榜列表
export function rankQueryPage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/activity/clockRank/queryPage',
    method: 'post',
    data
  })
}

/**
 * 导出统计--脱敏
 */
export function exportMask(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/activity/clockRank/exportMasking',
    method: 'post',
    responseType: 'blob',
    data
  })
}

/**
 * 导出统计--不脱敏
 */
export function exportNoMask(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/activity/clockRank/exportNoMasking',
    method: 'post',
    responseType: 'blob',
    data
  })
}


// 新建活动
export function insert(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/insert',
    method: 'post',
    data
  })
}

// 编辑活动
export function update(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/update',
    method: 'post',
    data
  })
}

// 活动详情
export function get(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/get',
    method: 'post',
    data
  })
}

// 删除活动
export function del(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/deleteByIds',
    method: 'post',
    data
  })
}

// 变更活动状态
export function upStatus(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/changeStatus',
    method: 'post',
    data
  })
}

// 任务详情
export function getConfig(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockTask/get',
    method: 'post',
    data
  })
}

// 新建任务
export function insertConfig(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockTask/insert',
    method: 'post',
    data
  })
}

// 获取任务
export function getByActivityId(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockTask/getByActivityId',
    method: 'post',
    data
  })
}

// 获取资源
// /backend/rushQuestions/queryPage  闯关
// /backend/courseInfo/queryPage  视频
export function getResource(url, data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: url,
    method: 'post',
    data
  })
}

// 添加资源
export function insertResource(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockResource/insert',
    method: 'post',
    data
  })
}

// 资源列表
export function queryPageResource(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockResource/queryPage',
    method: 'post',
    data
  })
}

// 单删资源
export function deleteResource(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockResource/deleteById',
    method: 'post',
    data
  })
}

// 批删资源
export function deleteMoreResource(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockResource/deleteByIds',
    method: 'post',
    data
  })
}
// 查询整体活动数据
export function getStatistics(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockActivity/statistics',
    method: 'post',
    data
  })
}
// 查询活动数据列表
export function getStatisticsList(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockRecord/statistics',
    method: 'post',
    data
  })
}
// 查询个人详细打卡信息
export function getStatisticsDetail(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockRecord/statisticsDetail',
    method: 'post',
    data
  })
}

/**
 * 抽奖活动查询
 * @param {*} query
 */
export function queryChooePage(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: 'backend/bigTurntable/queryPage',
    method: 'post',
    data
  })
}

/**
 * 导出脱敏
 */
export function maskAPI(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockRecord/clockRecordExportMasking',
    method: 'post',
    responseType: 'blob',
    data
  })
}
/**
 * 导出不脱敏
 */
export function noMaskAPI(data) {
  return request({
    baseURL: '/API-ENTERPRISE-BACKEND/',
    url: '/backend/clockRecord/clockRecordExportNoMasking',
    method: 'post',
    responseType: 'blob',
    data
  })
}

